package com.android.hedgehog.puzzles;

public class WireWord {
	public int wireNumber;
	public String wireColor;
	public int x;
	public int y;
	public int type;
	public int alpha = 255;
	public int alphaStage = 0;
	public double alphaTime;

	public WireWord(int num, String color) {
		wireNumber = num;
		wireColor = color;
		setPosition();
	}

	private void setPosition() {
		if (wireNumber < 10) {
			x = 32 + ((wireNumber % 5) * 64);
		} else {
			x = 40 + ((wireNumber % 5) * 80);
		}
		y = 50 + (20 * (wireNumber / 5));
	}

	public void updateAlpha(double deltaTime) {

		if (alphaStage == 0) {
			alpha += 5;
			if (alpha == 255)
				alphaStage = 1;
		}

		if (alphaStage == 1) {//
			alphaTime += deltaTime;
			if (alphaTime >= .5) {
				alphaStage = 2;
				alphaTime = 0.0;
			}

		}//

		if (alphaStage == 2) {//
			alpha -= 5;
			if (alpha == 0)
				alphaStage = 3;
		}//

		if (alphaStage == 3) {//
			alphaTime += deltaTime;
			if (alphaTime >= 2.0) {
				alphaStage = 0;
				alphaTime = 0.0;
			}
		}//

	}

}
